home *** CD-ROM | disk | FTP | other *** search
- /*
- * environ.c:
- * by Gaige B. Paulsen
- ****************************************************************************
- * Part of NCSA Telnet for the Macintosh *
- * *
- * Uses : *
- * TCP/IP kernel for NCSA Telnet *
- * by Tim Krauskopf *
- * with Macintosh code by Gaige B. Paulsen *
- * *
- * National Center for Supercomputing Applications *
- * 152 Computing Applications Building *
- * 605 E. Springfield Ave. *
- * Champaign, IL 61820 *
- * *
- * *
- ****************************************************************************
- *
- * Code to set up the environment variables.
- *
- * Called by:
- * maclook.c
- */
-
-
- #include <Stdio.h>
-
- #include <Types.h>
- #include <Dialogs.h> /* BYU 2.4.15 */
- #include <OSUtils.h>
- #include <Script.h>
- #include <Errors.h>
-
- #include "configrec.h"
- #include "maclook.h"
-
- #define SYSENVIRON
- #define UnImplTrapNum 0x9f
- #define ScriptTrapNum 0xbf
- #define WNETrapNum 0x60
- #define SlotManagerNum 0x6E
-
- #define CurrentVersion 1 /* Last known SysEnvirons version */
- #define HFSPtr ((long *)1014)
-
- int Juggling; /* True if Multifinder is running */
- int ScriptManager; /* True if have scriptmanager */
- int HFS; /* True if HFS */
- int SlotManager; /* True if have slotmanager */
- int HasColor=0; /* True if have color quickdraw */
- long SysScriptKeys, SysScriptIcon; /* The current script icon and keys */
- SysEnvRec theWorld; /* System Environment record */
-
- int InquireEnvironment
- (
- void
- )
- {
- OSErr err;
- long *HFSp=(long *)1014L; /* I HATE LOW GLOBALS !!!! */
-
- HFS= (*HFSp) > 0L;
- if (HFS) putln("Under HFS"); /* Check for HFS */
- else putln("Under MFS");
-
- ScriptManager = GetTrapAddress(UnImplTrapNum) !=
- GetTrapAddress(ScriptTrapNum);
- if (ScriptManager) {
- SysScriptKeys= GetScript( smRoman, smScriptKeys);
- SysScriptIcon= GetScript( smRoman, smScriptIcon);
- }
-
- #ifdef SYSENVIRON
- err = SysEnvirons(CurrentVersion, &theWorld);
- if (err == envVersTooBig) {
- /* should post a message saying we need to be updated */
- putln("SysEnvirons out of date!");
- }
- if (err != noErr) /* possibly not available assume nothing here! */
- return(0);
- #endif SYSENVIRON
-
- HasColor = theWorld.hasColorQD;
-
- #ifdef NGETTRAP
- Juggling = NGetTrapAddress(WNETrapNum, ToolTrap) !=
- NGetTrapAddress(UnImplTrapNum, ToolTrap);
- #else
- Juggling = GetTrapAddress(WNETrapNum) !=
- GetTrapAddress(UnImplTrapNum);
- #endif
- if (Juggling)
- putln("Juggling!"); /* BYU */
-
- #ifdef NGETTRAP
- SlotManager = NGetTrapAddress(SlotManagerNum, ToolTrap) !=
- NGetTrapAddress(UnImplTrapNum, ToolTrap);
- #endif
- return(1);
- }
-
- #ifdef AZTEC
- SysEnvirons( vreq, p)
- int vreq;
- SysEnvRec *p;
- {
-
- if (GetTrapAddress( 0xA090) == GetTrapAddress( UnImplTrapNum)) {
- putln("No sysenvirons...");
- return(-1);
- }
-
- putln("Going In....");
- if (0 == SECall( vreq, p)) {
- putln("No Error");
- return(0);
- }
- else return(-1);
- }
-
- #asm
- _SECall move.w 4(sp),d0
- movea.l 6(sp),a0
- dc.w $a090
- rts
- #endasm
- #endif AZTEC